﻿using System;
using UnityEngine;
using UnityEngine.EventSystems;
namespace HBFramework
{
    /// <summary>
    /// Pointer点击观测
    /// </summary>
    [DisallowMultipleComponent]
    public class PointerObserver : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IPointerClickHandler
    {
        public event Action<PointerEventData> OnPointerDownAct;
        public event Action<PointerEventData> OnPointerUpAct;
        public event Action<PointerEventData> OnPointerClickAct;

        public void OnPointerClick(PointerEventData eventData)
        {
            OnPointerClickAct?.Invoke(eventData);
        }

        public void OnPointerDown(PointerEventData eventData)
        {
            OnPointerDownAct?.Invoke(eventData);
        }

        public void OnPointerUp(PointerEventData eventData)
        {
            OnPointerUpAct?.Invoke(eventData);
        }
    }
}